/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.validation.constraints.Past;

/**
 *
 * @author ben
 */
@Entity
public class Transactions implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @OneToOne(cascade = CascadeType.ALL)
    private Credit credit;
    
    @ManyToOne
    private CompanyDenomination companyDenomination;

    public CompanyDenomination getCompanyDenomination() {
        return companyDenomination;
    }

    public void setCompanyDenomination(CompanyDenomination companyDenomination) {
        this.companyDenomination = companyDenomination;
    }
    
    

    
    
    @Past
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date transactionDate;
    
    private String mpowerAccountNumber;

    public String getMpowerAccountNumber() {
        return mpowerAccountNumber;
    }

    public void setMpowerAccountNumber(String mpowerAccountNumber) {
        this.mpowerAccountNumber = mpowerAccountNumber;
    }
    


    public Date getTransactionDate() {
        return transactionDate;
    }

    public void setTransactionDate(Date transactionDate) {
        this.transactionDate = transactionDate;
    }

    public Long getId() {
        return id;
    }

    
    
    
    public Credit getCredit() {
        return credit;
    }

    public void setCredit(Credit credit) {
        this.credit = credit;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transactions)) {
            return false;
        }
        Transactions other = (Transactions) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.Transaction[ id=" + id + " ]";
    }
}
